import request from "@/utils/request";
import type {
  GetRoleListApiParams,
  GetRoleListApiResponse,
} from "./model/roleModel";
enum Api {
  getRoleList = "/admin/acl/role",
  saveRole = "/admin/acl/role/save",
}

// 获取角色分页列表
export const getRoleListApi = ({
  page,
  limit,
  roleName,
}: GetRoleListApiParams) => {
  return request.get<any, GetRoleListApiResponse>(
    `${Api.getRoleList}/${page}/${limit}`,
    {
      params: {
        roleName,
      },
    }
  );
};

// 添加角色
export const saveRoleApi = (roleName: string) => {
  return request.post<any, null>(Api.saveRole, { roleName });
};
